package com.sh.责任链模式.one;

/**
 * @Author: sh
 */
public class Main {
    public static void main(String[] args) {
        //创建一个请求
        ApproverRequest approveRequest = new ApproverRequest(1, 29000, 1);
        //创建相关的审批人
        DepartmentApprover departmentApprover = new DepartmentApprover("张主任");
        CollegeApprover collegeApprover = new CollegeApprover("李院长");
        ViceSchoolMasterApprover viceSchoolMasterApprover = new ViceSchoolMasterApprover("王副校");
        SchoolMasterApprover schoolMasterApprover = new SchoolMasterApprover("佟校长");

        //需要将各个审批级别的下一个设置好
        departmentApprover.setNext(collegeApprover);
        collegeApprover.setNext(viceSchoolMasterApprover);
        viceSchoolMasterApprover.setNext(schoolMasterApprover);
        //单向责任链这里可以不加
//        schoolMasterApprover.setNext(departmentApprover);

        departmentApprover.processApprover(approveRequest);   // 向张主任审批          王副校 处理
        viceSchoolMasterApprover.processApprover(approveRequest);   // 向王副校审批    王副校 处理
    }
}
